home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS Toolkit
/
BBS Toolkit.iso
/
windows
/
deact102.zip
/
DEACTV10.WAS
< prev
next >
Wrap
Text File
|
1992-12-03
|
7KB
|
119 lines
;DEACTV V1.02 Hangup if no activity for x amount of time
;****************************************************************************
;* *
;* DEACTV10.WAS *
;* Copyright (C) 1992 Datastorm Technologies, Inc. *
;* All rights reserved. *
;* *
;* Author: Arthur Yousif *
;* *
;* Purpose: Provide a timeout feature when connecting to services *
;* that do not provide it. After a specified amount of *
;* time with no activity on the port, will disconnect the *
;* session. The default is 300 seconds (5 minutes) if no *
;* value is entered by user. *
;* *
;* This ASPECT SCRIPT is intended only as a sample of ASPECT programming. *
;* DATASTORM makes no warranty of any kind, express or implied, including *
;* without limitation, any warranties of merchantability and/or fitness *
;* for a particular purpose. Use of this program is at your own risk. *
;* *
;****************************************************************************
;****************************************************************************
;* Global Variables *
;****************************************************************************
;* *
;* TimeValue - contains number of seconds to wait *
;* DialogInput - contains value returned by $DIALOG *
;* GetTime - will contain user input value *
;* *
;****************************************************************************
integer TimeValue=300, DialogInput
string GetTime
;****************************************************************************
;* MAIN *
;* *
;* Will call the procedure for user input and then wait for the *
;* amount of time specified. If no time is specified, 300 seconds *
;* (5 minutes) is used as a default. *
;* *
;* Calls: GetInput, Deactivate *
;* Modifies globals: (None) *
;****************************************************************************
proc main
GetInput() ;get user input
when quiet TimeValue call Deactivate ;wait x time of inactivity
; before deactivating
while 1 ;loop
endwhile
endproc
;****************************************************************************
;* GETINPUT *
;* *
;* Will display a dialog box that prompts the user for the number of *
;* seconds to use as a timeout value. *
;* *
;* Calls: (None) *
;* Called by: (None) *
;* Modifies globals: TimeValue, DialogInput and GetTime *
;****************************************************************************
proc GetInput
GetTime = "300" ;initialize to default value
statmsg "" ;clear status line
dialogbox 136 87 192 62 6 "Deactivate" ;display dialog box
text 6 17 64 8 left "Disconnect after"
editbox 73 16 24 12 GetTime 5 ;get user input
text 109 18 72 8 left "seconds of no activity"
pushbutton 42 36 40 14 "&Ok" normal default
pushbutton 112 36 40 14 "&Cancel" cancel
enddialog
DialogInput = $DIALOG ;init dialog variable
while (DialogInput != 10)&&(DialogInput != 1) ;loop while Ok & Cancel
; buttons not pressed
DialogInput = $DIALOG
endwhile
switch DialogInput ;check for which button was pressed
case 1 ;Cancel pressed, so we
exit ; exit the program
endcase
endswitch
destroydlg ;remove dialog box and continue with script
strlen GetTime I0 ;get length of input variable
if I0 > 0 ;if there is input,
atoi GetTime TimeValue ;move & convert value to an int variable
endif
endproc
;****************************************************************************
;* DEACTIVATE *
;* *
;* This procedure is called when the number of seconds of no activity *
;* is reached. Will notify the user that it's disconnecting line *
;* due to inactivity, then hangup and notify user that line is *
;* disconnected. *
;* *
;* Calls: (None) *
;* Called by: Main *
;* Modifies globals: (None) *
;****************************************************************************
proc Deactivate
statmsg "Disconnecting line due to inactivity" ;disp msg on status line
hangup
pause 1
statmsg "Line disconnected" ;disp msg on status line
exit ;exit script
endproc